/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
using NetProtocol.Enum;

namespace NetProtocol.POD {

	/// <summary>
	///  灵魂数据
	/// module : structs
	/// </summary>
	public class SoulPOD : IPOD 
    {
        public readonly static Func<SoulPOD> FACTORY = () => new SoulPOD();
		public static Func<SoulPOD> DynamicFactory = FACTORY;
        
		/*-- members --*/
		/// <summary>
        ///  灵魂cid
        /// </summary>
		public int cid;
		/// <summary>
        ///  皮肤cid -- 默认皮肤也穿上
        /// </summary>
		public int skinCid;
		
		
		
		/*-- constructors --*/
		public SoulPOD() {}
		public SoulPOD(int cid, int skinCid) {
			this.cid = cid;
			this.skinCid = skinCid;
		}
	      public void Serial(SOutputStream _out) {
            _out.Write_int(cid);
            _out.Write_int(skinCid);
        }
        
        public void UnSerial(SInputStream _in) {
            if(!_in.HasRemaining()) return;
            cid = _in.Read_int();
            if(!_in.HasRemaining()) return;
            skinCid = _in.Read_int();
        }
		
		public SoulPOD Clone() {
            SoulPOD o = DynamicFactory();
            o.cid = cid;
            o.skinCid = skinCid;
            return o;
        }
        
        public void Clear() {
            cid = default;
            skinCid = default;
        }
		
        public override string ToString() {
			string str = "";
			str += "SoulPOD [";
			str += "cid=";
			str += cid;
			str += ", skinCid=";
			str += skinCid;
			str += "]";
			return str;
		}
		
	}
}